/**
 * @section LICENSE
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details at
 * http://www.gnu.org/copyleft/gpl.html
 */

#ifndef RECTANGLE_H
#define RECTANGLE_H

#include <Point.h>

namespace BlockDropper
{

struct Rectangle
{
	Rectangle()
		: topLeft()
		, bottomRight()
	{
	}

	Rectangle(const Point<unsigned short> & newTopLeft, const Point<unsigned short> & newBottomRight)
		: topLeft(newTopLeft)
		, bottomRight(newBottomRight)
	{
	}

	unsigned short bottom() const
	{
		return bottomRight.y;
	}

	unsigned short height() const
	{
		return bottomRight.y - topLeft.y;
	}

	unsigned short left() const
	{
		return topLeft.x;
	}

	unsigned short right() const
	{
		return bottomRight.x;
	}

	unsigned short top() const
	{
		return topLeft.y;
	}

	unsigned short width() const
	{
		return bottomRight.x - topLeft.x;
	}

	Point<unsigned short> topLeft;
	Point<unsigned short> bottomRight;
};

} // end namespace BlockDropper

#endif // RECTANGLE_H

